package cn.kp.learning.service.Impl;
import java.util.HashMap;
import cn.kp.learning.dao.PeopleDao;
import cn.kp.learning.model.People;
import cn.kp.learning.model.PeopleExample;
import cn.kp.learning.service.PeopleService;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

@Service("peopleService")
public class PeopleServiceImpl implements PeopleService {
	@Resource
	private PeopleDao peopleDao;

	@Override
	public int addPeople(People pl) {
		// TODO Auto-generated method stub
		return peopleDao.insertSelective(pl);
	}
	@Override
	public int addPeopleList(List<People> lt) {
		// TODO Auto-generated method stub
		return 0;
	}
	@Override
	public int deletePeopleByUserName(String userName) {
		// TODO Auto-generated method stub
		return 0;
	}
	@Override
	public int updatePeople(People pl) {
		// TODO Auto-generated method stub
		return peopleDao.updateByPrimaryKeySelective(pl);
	}
	@Override
	public People getPeople(HashMap<String, Object> hm) {
		// TODO Auto-generated method stub
		PeopleExample pe = new PeopleExample();
		pe.createCriteria().andUserNameEqualTo(hm.get("userName").toString());
		return (People) peopleDao.selectPeople(pe);
	}
	@Override
	public List<People> selectPeopleList(PeopleExample example) {
		// TODO Auto-generated method stub
		return peopleDao.selectPeopleList(example);
	}
	@Override
	public People selectPeopleLogin(HashMap<String, Object> hm) {
		return peopleDao.selectPeopleLogin(hm);
	}
	@Override
	public int countPeople(PeopleExample example) {
		// TODO Auto-generated method stub
		return peopleDao.countByExample(example);
	}
}
